package com.ease.component.skins {
    import mx.core.UIComponent;
    import mx.skins.ProgrammaticSkin;
    import mx.styles.StyleManager;

    public class MenuSeparator extends ProgrammaticSkin {
        public function MenuSeparator() {
            super();
        }

        override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
            super.updateDisplayList(unscaledWidth, unscaledHeight);

            var separatorThickness:Number;
            var separatorColor:uint;
            var myParent:UIComponent = parent as UIComponent;

            if (myParent) {
                separatorThickness = myParent.getStyle("separatorThickness");
                separatorColor = myParent.styleManager.getColorName(myParent.getStyle("separatorColor"));
            }

            if (separatorColor == StyleManager.NOT_A_COLOR) {
                separatorColor = 0x000000;
            }
            if (isNaN(separatorThickness)) {
                separatorThickness = 1;
            }

            graphics.clear();
            graphics.lineStyle(separatorThickness, separatorColor);
            graphics.moveTo(0, 0);
            graphics.lineTo(unscaledWidth, 0);
        }
    }
}
